import request from '../../utils/httpRequest'

const attrattrgrouprelation = '/product/product/attrattrgrouprelation'

// 查询list
export function getAttrAttrgroupRelationList (param) {
  return request({
    url: `${attrattrgrouprelation}/list`,
    method: 'get',
    param
  })
}

// 查询分组id下所有的基本属性
export function getRelationAttrByAttrgroupId (id) {
  return request({
    url: `${attrattrgrouprelation}/${id}/attr/relation`,
    method: 'get'
  })
}

// 查询分组id下所有的未关联基本属性
export function getNoRelationAttrByAttrgroupId (params, id) {
  return request({
    url: `${attrattrgrouprelation}/${id}/noattr/relation`,
    method: 'get',
    params: params
  })
}

// 根据ids批量删除
export function deleteAttrAttrgroupRelationByIds (data) {
  return request({
    url: `${attrattrgrouprelation}/delete`,
    method: 'delete',
    data
  })
}

// 根据id查询
export function getAttrAttrgroupRelationById (id) {
  return request({
    url: `${attrattrgrouprelation}/info/${id}`,
    method: 'get'
  })
}

// 新增
export function saveBatchAttrAttrgroupRelation (data) {
  return request({
    url: `${attrattrgrouprelation}/save/batch`,
    method: 'post',
    data
  })
}

// 修改
export function updateAttrAttrgroupRelation (data) {
  return request({
    url: `${attrattrgrouprelation}/update`,
    method: 'put',
    data
  })
}
